<extend name="Public:iframe" />
<block name="content">
    <form class="layui-form" action="">
        <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-block">
                <input type="text" name="username" required  lay-verify="required" placeholder="请输入用户民" autocomplete="off" class="layui-input">
                <span style="color:#FF5722">注：默认密码为12345678</span>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">所属权限</label>
            <div class="layui-input-block">
                <select name="auth_group" lay-verify="required">
                    <option value=""></option>
                    <volist name="auth" id="au">
                        <option value="{$au.id}">{$au.name}</option>
                    </volist>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="button" class="layui-btn" lay-submit lay-filter="save">保存</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>

</block>

<block name="foot_script">
    <script>
        $(layui.use(['layer','form','upload'], function(){
            var layer = layui.layer,form = layui.form,upload = layui.upload;


            form.on('submit(save)',function (data) {
                $.post('{:U("Adminrole/addmem")}',data.field,function (res) {
                    if (res.code === 1){
                        layer.msg(res.msg,{time:1000},function () {
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                            parent.location.reload();
                        });
                    } else {
                        layer.msg(res.msg,{time:1000});
                    }
                });
                return false;
            });

        }));

    </script>
</block>